﻿/**	@file		locked_operator.h
 *	@date		(2010-04-14 23:39:57)/(2012-01-12 20:43:58)
 *-----------------------------------------------------------------------------
 *	@version	1.0.2.5
 *	@author		Nick Shallery	(nicknide@gmail.com)
 *	@copyright	YOU HAVE ALL LEFT WITH THIS CODE WHILE YOU KEEP COMMENT IN EVERY COPY.
 *-----------------------------------------------------------------------------
**/


#if			!defined(__LOLIX__LOLI__LOCKED_OPERATOR__NICK__K_IN_G__)
#define		__LOLIX__LOLI__LOCKED_OPERATOR__NICK__K_IN_G__
//==============================================================================
//--------------------------------------------------------------------------


#if			!defined(__LOLIX__LOLI_X_CFG__K_IN_G__)
	#include	"../lolix_cfg.h"
#endif	//	!defined(__LOLIX__LOLI_X_CFG__K_IN_G__)

#if			!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)
	#include	"../lolix_type.h"
#endif	//	!defined(__LOLIX__LOLIX_TYPE__K_IN_G__)


namespace lolix{namespace loli{

class LOLIX_NO_VTABLE locked_operator
	: public lolix::itf
{
public:
	LOLIX_DECLARE_ITF(lolix::loli::locked_operator, lolix::itf, (0x199cafae, 0x267742cb, 0xbd7af849, 0xdf4c8f5a));
	LOLIX_INTERFACE(chg_32		, lx_u32	, (lx_u32* addr, lx_u32 dat));
	LOLIX_INTERFACE(cmp_chg_32	, lx_u32	, (lx_u32* addr, lx_u32 dat, lx_u32 cmp));
	LOLIX_INTERFACE(inc_32		, lx_u32	, (lx_u32* dat));
	LOLIX_INTERFACE(dec_32		, lx_u32	, (lx_u32* dat));
	LOLIX_INTERFACE(add_32		, lx_u32	, (lx_u32* dat, lx_u32 val));
	LOLIX_INTERFACE(sub_32		, lx_u32	, (lx_u32* dat, lx_u32 val));

	LOLIX_INTERFACE(or_32		, lx_u32	, (lx_u32* dat, lx_u32 val));
	LOLIX_INTERFACE(xor_32		, lx_u32	, (lx_u32* dat, lx_u32 val));

	//LOLIX_INTERFACE(chg_64		, lx_u64	, (lx_u64* addr, lx_u64 dat));
	//LOLIX_INTERFACE(cmp_chg_64	, lx_u64	, (lx_u64* addr, lx_u64 dat, lx_u64 cmp));
	//LOLIX_INTERFACE(inc_64		, lx_u32	, (lx_u32* dat));
	//LOLIX_INTERFACE(dec_64		, lx_u32	, (lx_u32* dat));
	//LOLIX_INTERFACE(add_64		, lx_u32	, (lx_u64* dat, lx_u64 val));
	//LOLIX_INTERFACE(sub_64		, lx_u32	, (lx_u64* dat, lx_u64 val));

	LOLIX_INTERFACE(chg_size	, size_type	, (size_type* addr, size_type dat));
	LOLIX_INTERFACE(cmp_chg_size, size_type	, (size_type* addr, size_type dat, size_type cmp));

	LOLIX_INTERFACE(chg_ptr		, void*		, (void** addr, void* dat));
	LOLIX_INTERFACE(cmp_chg_ptr	, void*		, (void** addr, void* dat, void* cmp));

	template<typename _Ty>
	LOLIX_INLINE_CALL _Ty* chg_ptr(_Ty** addr, _Ty* dat){ return static_cast<_Ty*>(this->chg_ptr((void**)addr, (void*)dat)); }
	template<typename _Ty>
	LOLIX_INLINE_CALL _Ty* chg_ptr(_Ty** addr, _Ty* dat, _Ty* cmp){ return static_cast<_Ty*>(this->chg_ptr((void**)addr, (void*)dat, (void*)cmp)); }
};

}}

//
//--------------------------------------------------------------------------
//==============================================================================
#endif	//	!defined(__LOLIX__LOLI__LOCKED_OPERATOR__NICK__K_IN_G__)
